﻿using System.ComponentModel.Composition;
using System.Windows.Media;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;

namespace PostscriptTools {
	#region Format definitions for postscript classificationtypes

	// some ps operators are not listed here. Hey take their Format Definition from the standard definitions (String, Comment, Number, Name, operator)
	[Export(typeof(EditorFormatDefinition))]
	[ClassificationType(ClassificationTypeNames = "postscript.procoperator")]
	[Name("postscriptProcOperator")]
	[UserVisible(true)]  // this means that it shows up in Tools->Options->Environment->Font and Colors (under the name DisplayName)
	[Order(Before = Priority.High, After = Priority.Default)]
	internal sealed class PostscriptPsProcOperatorFormat : ClassificationFormatDefinition {
		public PostscriptPsProcOperatorFormat() {
			this.DisplayName = "Postscript { } Operator"; // this is the name the user sees
			this.ForegroundColor = Colors.DarkOrchid;
		}
	}

	[Export(typeof(EditorFormatDefinition))]
	[ClassificationType(ClassificationTypeNames = "postscript.hexstring")]
	[Name("postscriptHexString")]
	[UserVisible(true)]
	[Order(After = Priority.Default)]
	internal sealed class PostscriptNameHexStringFormat : ClassificationFormatDefinition {
		public PostscriptNameHexStringFormat() {
			this.DisplayName = "Postscript <Hex> String";
			this.ForegroundColor = Colors.MediumVioletRed;
		}
	}

	[Export(typeof(EditorFormatDefinition))]
	[ClassificationType(ClassificationTypeNames = "postscript.ascii85string")]
	[Name("postscriptAscii85String")]
	[UserVisible(true)]
	[Order(After = Priority.Default)]
	internal sealed class PostscriptAscii85StringFormat : ClassificationFormatDefinition {
		public PostscriptAscii85StringFormat() {
			this.DisplayName = "Postscript <~Ascii85~> String";
			this.ForegroundColor = Colors.IndianRed;
		}
	}

	[Export(typeof(EditorFormatDefinition))]
	[ClassificationType(ClassificationTypeNames = "postscript.immediatename")]
	[Name("postscriptImmediateName")]
	[UserVisible(true)]
	[Order(After = Priority.Default)]
	internal sealed class PostscriptImmediateNameFormat : ClassificationFormatDefinition {
		public PostscriptImmediateNameFormat() {
			this.DisplayName = "Postscript //Immediate Name";
			this.ForegroundColor = Colors.BlueViolet;
		}
	}

	[Export(typeof(EditorFormatDefinition))]
	[ClassificationType(ClassificationTypeNames = "postscript.literalname")]
	[Name("postscriptLiteralName")]
	[UserVisible(true)]
	[Order(After = Priority.Default)]
	internal sealed class PostscriptLiteralNameFormat : ClassificationFormatDefinition {
		public PostscriptLiteralNameFormat() {
			this.DisplayName = "Postscript /Literal Name";
			this.ForegroundColor = Colors.Blue;
		}
	}

	[Export(typeof(EditorFormatDefinition))]
	[ClassificationType(ClassificationTypeNames = "postscript.arrayoperator")]
	[Name("postscriptArrayOperator")]
	[UserVisible(true)]
	[Order(Before = Priority.High, After = Priority.Default)]
	internal sealed class PostscriptPsArrayOperatorFormat : ClassificationFormatDefinition {
		public PostscriptPsArrayOperatorFormat() {
			this.DisplayName = "Postscript [ ] Operator";
			this.ForegroundColor = Colors.MediumOrchid;
		}
	}

	[Export(typeof(EditorFormatDefinition))]
	[ClassificationType(ClassificationTypeNames = "postscript.dictoperator")]
	[Name("postscriptDictOperator")]
	[UserVisible(true)]
	[Order(Before = Priority.High, After = Priority.Default)]
	internal sealed class PostscriptPsDictOperatorFormat : ClassificationFormatDefinition {
		public PostscriptPsDictOperatorFormat() {
			this.DisplayName = "Postscript << >> Operator";
			this.ForegroundColor = Colors.DarkOrange;
		}
	}

	[Export(typeof(EditorFormatDefinition))]
	[ClassificationType(ClassificationTypeNames = "postscript.binary")]
	[Name("postscriptBinary")]
	[UserVisible(true)]
	[Order(Before = Priority.High, After = Priority.Default)]
	internal sealed class PostscriptPsBinaryFormat : ClassificationFormatDefinition {
		public PostscriptPsBinaryFormat() {
			this.DisplayName = "Postscript Binary Data";
			this.IsItalic = true;
			this.ForegroundColor = Colors.Black;
		}
	}

	#endregion //Format definition
}
